{{template "common/header.html" .}}
{{template "common/nav.html" .}}
<section class="main">
    <div class="container">

        <div class="columns">
            <div class="column is-9">
                <div class="main-body">

                    <ul class="topic-list">
                        {{range .Topics}}
                            {{template "topic/list-item.html" .}}
                        {{end}}
                    </ul>

                    <nav class="pagination is-rounded is-small" role="navigation" aria-label="pagination">
                        {{if gt .Page.Page 1}}
                            <a class="pagination-previous" href="{{.PrePageUrl}}"><i class="iconfont icon-left"></i> 上一页</a>
                        {{else }}
                            <a class="pagination-previous" href="javascript:;"><i class="iconfont icon-left"></i>
                                上一页</a>
                        {{end}}

                        {{if lt .Page.Page .Page.TotalPage}}
                            <a class="pagination-next" href="{{.NextPageUrl}}">下一页 <i
                                        class="iconfont icon-right"></i></a>
                        {{else }}
                            <a class="pagination-next" href="javascript:;">下一页 <i class="iconfont icon-right"></i></a>
                        {{end}}
                    </nav>

                </div>
            </div>
            <div class="column is-3">
                <div class="main-aside">
                    <div class="widget">
                        <div class="content">
                            <a class="button is-success" href="{{baseUrl}}/topic/create"><i
                                        class="iconfont icon-topic"></i>&nbsp;<strong>发表讨论</strong></a>
                        </div>
                    </div>

                    {{ if .CurrentUser}}
                        <div class="widget">
                            <div class="header">个人信息</div>
                            <div class="content">
                                <img src="{{.CurrentUser.Avatar}}"/>
                                <div>
                                    <span>
                                        <i class="iconfont icon-username"></i>
                                        <a href="{{baseUrl}}/user/{{.CurrentUser.Id}}">{{.CurrentUser.Nickname}}</a>
                                    </span>
                                </div>
                                {{if .User.Description}}
                                    <div style="margin-top: 10px;">
                                        <p>{{.User.Description}}</p>
                                    </div>
                                {{end}}
                            </div>
                        </div>
                    {{end}}
                </div>
            </div>
        </div>

    </div>
</section>
{{template "common/footer.html" .}}
